package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.DishDTO;
import com.sky.entity.DishFlavor;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author 苏成博
 * @date 2023-02-08 10:58
 */
@Mapper
public interface DishFlavorMapper {
    /**
     * 新增口味
     * @param flavors
     */
    void saveDishFlavors(List<DishFlavor> flavors);
    /**
     *根据dishIds删除菜品
     */
    void deleteDishFlavors(List<Integer> dishIds);
    /**
     * 根据dishId查找口味数据
     * @param id
     */
    @Select("select * from dish_flavor where dish_id=#{id}")
    List<DishFlavor> findByDishId(Long id);

    /**
     *根据dish_id修改口味表
     * @param dishFlavor
     */
    @Update("update dish_flavor set name=#{name},value=#{value} where dish_id=#{dishId}")
    void updateFlavor(DishFlavor dishFlavor);

    /**
     * 新增单条数据
     * @param dishFlavor
     */
    @Insert("insert into dish_flavor(dish_id,name,value) values ( #{dishId}, #{name}, #{value})")
    void saveDishFlavor(DishFlavor dishFlavor);

    /**
     * 根据dishId删除口味信息
     * @param dishId
     */
    @Delete("delete from dish_flavor where dish_id=#{dishId}")
    void deleteDishFlavorByDishID(Long dishId);
}
